import { http } from "./axiosHttps";

const readBasicUrl= import.meta.env.VITE_ReadAPP_API_URL
const writeBasicUrl=import.meta.env.VITE_WriteAPP_API_URL;
//登录
export const login =(params={})=>{
    return http("get",readBasicUrl + `api/User/Login`,{},params);
}
//#region 用户
//显示
export const getUser =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetUser`,{},params);
}
//添加
export const addUser =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/AddUserRole`,data,{});
}
//修改
export const updateUser =(data={})=>{
    return http("post",writeBasicUrl + `aapi/Manager/UpdateUserRole`,data,{});
}
//修改
export const updateUserState =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/UpdateUserState`,data,{});
}
//删除
export const deleteUser =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/DeleteUserRole`,data,{});
}
//#endregion

//#region 角色
//获取所有角色
export const getALLRole =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetRole`,{},params);
}
//获取角色列表
export const getRole =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetRoles`,{},params);
}
//添加角色
export const addRole =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/AddRolePermission`,data,{});
}
//修改角色
export const updateRole =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/UpdateRolePermission`,data,{});
}
//修改角色
export const updateRoleState =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/UpdateRoleState`,data,{});
}
//删除角色
export const deleteRole =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/DeleteRolePermission`,data,{});
}
//#endregion

//#region  权限
//获取所有权限
export const getPermission =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetPermission`,{},params);
}

//获取全部权限
export const getAll =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetPermissionses`,{},params);
}

//获取动态加载菜单
export const getMenuss =(params={})=>{
    return http("get",readBasicUrl + `api/Manager/GetCascadeItem`,{},params);
}
//添加权限
export const addPermission=(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/AddPermission`,data,{});
}
//修改权限
export const updatePermission =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/UpdatePermission`,data,{});
}
//修改权限
export const updatePermissionState =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/UpdatePermissionState`,data,{});
}
//删除权限
export const deletePermission =(data={})=>{
    return http("post",writeBasicUrl + `api/Manager/DeletePermission`,data,{});
}
//#endregion

//#region 轮播图管理
export const showCarouselChart=(params={})=>{
    return http("get",readBasicUrl + `api/CarouselChart/ShowCarouselChart`,{},params);
}
//添加轮播图管理
export const addPCarouselChart=(data={})=>{
    return http("post",writeBasicUrl + `api/CarouselChart/AddAddCarouselChart`,data,{});
}

//上传图片到MinIO
export const uploadImage=(data:FormData)=>{
    return http("post","http://localhost:5142/" + `api/FileUpload/UploadFile`,data,{});
}
//修改轮播图管理
export const UpdatePCarouselChart=(data={})=>{
    return http("post",writeBasicUrl + `api/CarouselChart/UpdateCarouselChart`,data,{});
}
//删除轮播图管理
export const deleteCarouselChart=(data={})=>{
    return http("post",writeBasicUrl + `api/CarouselChart/DeleteCarouselChart`,data,{});
}
//#endregion

//#region 医院管理
export const showHospitals=(params={})=>{
    return http("get",readBasicUrl + `api/Hospital/ShowHospital`,{},params);
}

// 获取科室数据
export const getDepartments=()=>{
    return http("get",readBasicUrl + `api/CarouselChart/GetDepartments`,{},{});
}

//添加医院
export const addHospitals=(data={})=>{
    return http("post",writeBasicUrl + `api/Hospital/AddHospital`,data,{});
}

//修改医院
export const updateHospitals=(data={})=>{
    return http("post",writeBasicUrl + `api/Hospital/UpdateHospital`,data,{});
}

//删除医院
export const deleteHospitals=(data={})=>{
    return http("post",writeBasicUrl + `api/Hospital/DeleteHospital`,data,{});
}

//获取医院详情（通过医院列表API获取单个医院）
export const getHospitalDetail=(params={})=>{
    return http("get",readBasicUrl + `api/Hospital/ShowHospital`,{},params);
}


//#endregion

//#region 科室管理

//显示科室部门
export const ShowDepartments=(params={})=>{
    return http("get",readBasicUrl + `api/Department/ShowDepartments`,{},params);
}

//添加科室部门
export const AddDepartment=(data={})=>{
    return http("post",writeBasicUrl + `api/Department/AddDepartment`,data,{});
}

//修改科室部门
export const UpdateDepartment=(data={})=>{
    return http("post",writeBasicUrl + `api/Department/UpdateDepartment`,data,{});
}

//删除科室部门
export const DeleteDepartment=(data={})=>{
    return http("post",writeBasicUrl + `api/Department/DeleteDepartment`,data,{});
}
//#endregion


